<template>
    <view>
        <cu-custom bgColor="bg-gradual-green">
            <block slot="content">我的</block>
        </cu-custom>

        <view class="cu-card dynamic">
            <view class="cu-item shadow">
                <view class="cu-list menu-avatar">
                    <view class="cu-item">
                        <view class="cu-avatar round lg" style="background-image:url(../../static/head.png);" v-if="!userinfo"
                            @click="toNav('/pages/login/index')"></view>
                        <view class="cu-avatar round lg" :style="{'background-image':'url('+ userinfo.avatar +')'}"
                            v-if="userinfo"></view>
                        <view class="content" v-if="!userinfo" @click="toNav('/pages/login/index')">
                            点击登录，登陆后体验更多
                        </view>
                        <view class="content flex-sub" v-if="userinfo">
                            <view>{{userinfo.nickname}}</view>
                            <view class="text-gray text-sm flex justify-between">
                                粉丝数量：{{ userinfo.fans_count}}
                                &nbsp;&nbsp;&nbsp;
                                关注数量：{{ userinfo.focuses_count}}
                            </view>
                        </view>
                    </view>
                </view>
            </view>
        </view>

        <view class="cu-list menu sm-border card-menu">
           <view class="cu-item arrow"  @click="toNav('notice')">
                <view class="content">
                    <text class="cuIcon-noticefill text-red"></text>
                    <text class="text-grey">我的通知</text>
                </view>
                <view class="cu-tag" v-if="tag" style="background-color:#dd514c;border-radius: 50%;"></view>
            </view>
           <!-- <view class="cu-item arrow"  @click="toNav('wallet')">
                <view class="content">
                    <text class="cuIcon-moneybagfill text-red"></text>
                    <text class="text-grey">我的钱包</text>
                </view>
            </view> -->
            <view class="cu-item arrow" @click="toNav('/pages/kefu/index')">
                <view class="content">
                    <text class="cuIcon-emojifill text-blue"></text>
                    <text class="text-grey">联系客服</text>
                </view>
            </view>
            <view class="cu-item arrow" @click="toNav('follow')">
                <view class="content">
                    <text class="cuIcon-favorfill text-yellow"></text>
                    <text class="text-grey">我的关注</text>
                </view>
            </view>
            <view class="cu-item arrow" @click="toNav('fans')">
                <view class="content">
                    <text class="cuIcon-likefill text-red"></text>
                    <text class="text-grey">我的粉丝</text>
                </view>
            </view>
            <view class="cu-item arrow" @click="toNav('praise')">
                <view class="content">
                    <text class="cuIcon-appreciatefill text-orange"></text>
                    <text class="text-grey">我的点赞</text>
                </view>
            </view>
        </view>

        <view class="cu-list menu sm-border card-menu margin-top">

            <view class="cu-item arrow" @click="toNav('setData')">
                <view class="content">
                    <text class="cuIcon-settingsfill text-grey"></text>
                    <text class="text-grey">修改资料</text>
                </view>
            </view>
            <view class="cu-item arrow" @click="toNav('issue')">
                <view class="content">
                    <text class="cuIcon-roundcheckfill text-orange"></text>
                    <text class="text-grey">发布中</text>
                </view>
            </view>
           <view class="cu-item arrow" @click="toNav('examine')">
                <view class="content">
                    <text class="cuIcon-paintfill text-olive"></text>
                    <text class="text-grey">审核中</text>
                </view>
            </view>
        </view>

      <!--  <view class="cu-list menu sm-border card-menu margin-top">
            <view class="cu-item arrow">
                <view class="content">
                    <text class="cuIcon-peoplefill text-black"></text>
                    <text class="text-grey">个人认证（领养宠物需要填写）</text>
                </view>
            </view>
        </view> -->

        <view class="cu-tabbar-height margin-top"></view>

        <tabs :page="3"></tabs>
    </view>
</template>

<script>
    import Tabs from '../tabs/index.vue';
    import {
        mapState,
        mapActions
    } from 'vuex'

    export default {
        components: {
            Tabs,
        },
        data() {
            return {}
        },
        computed: {
            ...mapState(['userinfo','tag'])
        },
        onShow() {
            uni.getUserInfo({
            	provider: 'weixin',
            	success:(infoRes) => {
            		console.log(infoRes);
                    uni.showLoading({
                        title:'获取数据...'
                    })
            		this.wxLogin(infoRes.userInfo).then(res=>{
            			console.log(res)
                        this.getNoticeList();
                        uni.hideLoading();
            		})
            	},
            	fail(err) {
            		console.log(err)
            	}
            });
            
            console.log(this.userinfo)
            console.log("success")
            
        },
        onHide() {
            console.log("hehe")
        },
        onLoad() {
            console.log("haha", this.$store.state.location)
        },
        onPullDownRefresh() {
            //监听下拉刷新动作的执行方法，每次手动下拉刷新都会执行一次
            uni.stopPullDownRefresh(); //停止下拉刷新动画
        },
        methods: {
            ...mapActions(['wxLogin','getNoticeList']),
            toNav(link) {
                uni.navigateTo({
                    url: link
                })
            }
        }
    }
</script>

<style>

</style>
